package com.iflytek.jobs.app;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.iflytek.jobs.service.domain.Resume;
import com.iflytek.jobs.service.service.IResumeService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 简历信息Controller
 * 
 * @author chenhs
 * @date 2023-04-10
 */
@RestController
@RequestMapping("/App/resume")
public class AppResumeController extends BaseController
{
    @Autowired
    private IResumeService resumeService;

    /**
     * 查询简历信息列表
     */
    @PostMapping("/list")
    public TableDataInfo list(@RequestBody Resume resume)
    {

        startPage(true);
        List<Resume> list = resumeService.selectResumeList(resume);
        return getDataTable(list);
    }
    
    @PostMapping("/his")
    public TableDataInfo listHis(@RequestBody Resume resume)
    {
        startPage(true);
        List<Resume> list = resumeService.selectResumeHis(resume);
        return getDataTable(list);
    }

    /**
     * 获取简历信息详细信息
     */
    @GetMapping(value = "/{reId}")
    public AjaxResult getInfo(@PathVariable("reId") Integer reId)
    {
        return success(resumeService.selectResumeByReId(reId));
    }

    /**
     * 新增简历信息
     */
    @Log(title = "简历信息", businessType = BusinessType.INSERT)
    @PostMapping
    @PreAuthorize("@ss.notRole('demo')")
    public AjaxResult add(@RequestBody Resume resume)
    {
        return toAjax(resumeService.insertResume(resume));
    }

    /**
     * 修改简历信息
     */
    @Log(title = "简历信息", businessType = BusinessType.UPDATE)
    @PutMapping
    @PreAuthorize("@ss.notRole('demo')")
    public AjaxResult edit(@RequestBody Resume resume)
    {
        return toAjax(resumeService.updateResume(resume));
    }

    /**
     * 删除简历信息
     */
    @Log(title = "简历信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{reIds}")
    @PreAuthorize("@ss.notRole('demo')")
    public AjaxResult remove(@PathVariable String[] reIds)
    {
        return toAjax(resumeService.deleteResumeByReIds(reIds));
    }


  
}

